<?php

namespace App\Models;
use Illuminate\Database\Eloquent\Model;

class Food extends Model
{
    protected $guarded = [];

    protected $dateFormat = 'U';

    public function setBannerimageAttribute($pictures)
    {
        if (is_array($pictures)) {
            $this->attributes['bannerimage'] = json_encode($pictures);
        }
    }

    public function getContentAttribute($val)
    {
        if ($val==null||empty($val)&&count($val)<=0) {
            return '该美食还没有简介哟';
        }else{
            return $val;
        }
    }

    public function getBannerimageAttribute($pictures)
    {
        return json_decode($pictures, true);
    }



}
